/*
  StandInstance.h - 
  
  Created by the STA team at UMBC on 24 January 2013. 
  Edited (very slightly) by the LSI team at UMBC on 7 March 2014.
*/

// ensure this library description is only included once
#ifndef StandInstance_h
#define StandInstance_h

#include "StepperDriver.h"
#include "Decoder.h"

// library interface description
class StandInstance {

	public:
    StandInstance(int azInitPos, int elInitPos);
    int runRoute(int azLowBound, int azHighBound, int altLowBound, int altHighBound); // Unimplemented
    void disableAltSD(); // Unimplemented

	private:
    void moveTo(int newAz, int newEl);
    int moveToSimultaneous(int newAz, int newEl);
    int moveToAccel(int newAz, int newEl, bool nhmode=true);
    int moveAccelerate(long azSteps, int azStartingSPS, int azSPSPS, int azStepMode, long elSteps, int elStartingSPS, int elSPSPS, int elStepMode);
    long stepAzimuth(long steps);
    long stepElevation(long steps);
    void resetPosition();
    int getAzimuth();
    int getElevation();
    long azDegToStep(int degrees);
    long elDegToStep(int degrees);
    bool isValidAzPos(int newAz);
    bool isValidElPos(int newEl);

    void sendCoord(); // Unimplemented
    void getRange(); // Unimplemented
    void reset();  // Unimplemented

    StepperDriver *azDriver;
    StepperDriver *elDriver;
    Decoder *decoder;
    void updatePosition(int newAz, int newEl);

    int azPos;
    int elPos;

    // Scanning region
    int routeAzLowBound;
    int routeAzHighBound;
    int routeAltLowBound; 
    int routeAltHighBound;

};

#endif

